Tag Types
Tag objects have types in order to identify their purpose. For example, if you want to identify a circle that is approximated by a QuickDraw GX path shape, you might attach to it a tag of type'CRCL'
. Then, whenever your application scales a path shape, it can first check to see if there is a tag object of type'CRCL'
attached to that shape. If there is, your application can make sure that the scaling preserves the circularity of the result. If your application has its own circle-drawing function, it can call that function instead of callingGXDrawShape
to draw the circle.The creator of a tag object can give it any 4-byte type value, although it is customary to make it a value that can be represented with four 1-byte ASCII characters. Apple Computer, Inc., reserves all tag types that can be represented with lowercase characters only, such as
'dave'
. There are no other restrictions, except that a tag type cannot be 0. If you intend your tag type to be exportable (usable by other applications), you can be certain that it will not conflict with other applications' tag types if you use your application's creator type, as registered with Macintosh Developer Technical Support, as your tag type.
Some tag types have already been defined for specific purposes. QuickDraw GX uses tag objects for printing synonyms, which include data such as PostScript commands that replace the QuickDraw GX drawing commands for printing on PostScript printers. QuickDraw GX also uses tag objects to list fonts and individual glyphs used by flattened shapes. There are several currently defined tag types for printing synonyms, one for flattened fonts and glyphs, plus other tag types for various other purposes. Table 8-1 lists some of the currently defined tag types.
- Note
- A four-character tag type is not portable. On systems other than the Macintosh, the tag type may print or display quite differently, and one with the same appearance may have a very different numeric value. For maximum portability, it is best to define tag types with hexadecimal values, such as
#define daveTag 0x44415645 /* 'DAVE' */
- In this way, the tag type
daveTag
will be correct regardless of the architecture of the machine it is defined on.![]()